home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-07-28 | 8.3 KB | 328 lines | [TEXT/MPS ] |
- /*
- File: OutgoingLetterStream.cp
-
- Contains: xxx put contents here xxx
-
- Written by: Tim Harnett
-
- Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <2> 1/27/95 TMH handle unresolved recipients
- <1> 1/13/95 TMH abstract class for outgoing letter
- 1/11/95 TMH xxx put comment here xxx
-
- To Do:
- */
-
-
- #ifndef __TEXTUTILS__
- #include "TextUtils.h"
- #endif
-
- #ifndef __PMSAMResourceIds__
- #include "PMSAMResourceIDs.h"
- #endif
-
- #ifndef __Debug__
- #include "Debug.h"
- #endif
-
-
- #ifndef __CDSSpec__
- #include "CDSSpec.h"
- #endif
-
- #ifndef __MSAMSlot__
- #include "MSAMSlot.h"
- #endif
-
- #ifndef __XLetter__
- #include "XLetter.h"
- #endif
-
- #ifndef __OutgoingLetterStream__
- #include "OutgoingLetterStream.h"
- #endif
-
- //--------------------------------------------
- // C O u t g o i n g L e t t e r S t r e a m
- //--------------------------------------------
-
- #pragma segment OutgoingLetterStream
-
- //--------------------------------------------------------------------------------
- COutgoingLetterStream::COutgoingLetterStream(TMSAMSlot* msamSlot)
- {
- ASSERT(msamSlot);
- fMSAMSlot = msamSlot;
- }
-
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteSendDate(MailTime& /* utcTime*/)
- {
- ASSERTPRINT(false,("Must Override COutgoingLetterStream::WriteSendDate\n") );
- }
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteSubject(StringPtr /*subject*/)
- {
- ASSERTPRINT(false,("Must Override COutgoingLetterStream::WriteSubject\n") );
- }
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::BeginBody()
- {
-
- }
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::EndBody()
- {
-
- }
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteBodyText(char* /*text*/,long /*textLen*/,Boolean /*more*/)
- {
- ASSERTPRINT(false,("Must Override COutgoingLetterStream::WriteBodyText\n") );
- }
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteBodyStr(char* text)
- {
- long textLen = strlen(text);
- this->WriteBodyText(text,textLen,true);
-
- }
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteBodyStr(StringPtr text)
- {
- this->WriteBodyText((char*)&text[1],(long)text[0],true);
- }
-
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WritePict(void* /* pictData*/,long /*pictDataLen*/,Boolean /*more*/)
- {
- }
-
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteSound(void* /* soundData*/,long /*soundDataLen*/,Boolean /*more*/)
- {
- }
-
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteMovie(void* /*movieData*/,long /*movieDataLen*/,Boolean /*more*/)
- {
- }
-
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteNestedSendDate(MailTime& /* utcTime*/)
- {
- ASSERTPRINT(false,("Must Override COutgoingLetterStream::WriteMovie\n") );
-
- }
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteNestedSubject(StringPtr /*subject*/)
- {
- ASSERTPRINT(false,("Must Override COutgoingLetterStream::WriteMovie\n") );
- }
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::BeginNestedLetter()
- {
- Str255 headerStr;
-
- headerStr[0] = 0;
-
- GetIndString(headerStr, kLetterHeaderStringsResID, kNestedLetterHeader);
-
- this->WriteBodyStr(headerStr);
-
- }
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::EndNestedLetter()
- {
- this->WriteBodyStr("\n\n"); // more assumptions.
- }
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::BeginNestedRecipients(short recipientType)
- {
-
- Str255 headerStr;
-
- headerStr[0] = 0;
-
- switch(recipientType) {
-
- case kMailFromBit:
- GetIndString(headerStr, kLetterHeaderStringsResID, kNestedFromHeader);
- break;
-
- case kMailToBit:
- GetIndString(headerStr, kLetterHeaderStringsResID, kNestedToHeader);
- break;
-
- case kMailCcBit:
- GetIndString(headerStr, kLetterHeaderStringsResID, kNestedCcHeader);
- break;
-
- default:
- ASSERTPRINT(false,("COutgoingLetterStream::BeginNestedRecipients Unknown recipient type =%0X\n",recipientType) );
- break;
- };
-
-
- this->WriteBodyStr(headerStr);
-
- }
-
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::EndNestedRecipients(short /*recipientType*/)
- {
- this->WriteBodyStr("\n\n"); // more assumptions.
- }
-
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteNestedRecipient(CUnpackedDSSpec& unpackedRecipient,short recipientType,short recipientCount)
- {
-
- if( fMSAMSlot->IsOurRecipient(unpackedRecipient) ) {
-
- this->WriteNestedRecipient(unpackedRecipient.ExtValue(),recipientType,recipientCount);
-
- } else {
-
- Str255 otherRecipient; // non-EWorldAddress
- ::MapOtherRecipient(unpackedRecipient,otherRecipient);
-
- this->WriteNestedRecipient(otherRecipient,recipientType, recipientCount);
-
- }
-
- }
-
-
-
- //--------------------------------------------------------------------------
- void COutgoingLetterStream::WriteNestedRecipient(StringPtr recipient,short /*recipientType*/,short recipientCount)
- {
-
- // Assumption : that the nested recipients are placed in the
- // outgoing letters body. --- could be presumptious.
-
- if( recipientCount != 1 )
- this->WriteBodyStr(",\n");
-
-
- this->WriteBodyStr(recipient);
-
- }
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteResolvedRecipient(CUnpackedDSSpec& unpackedRecipient,short recipientType,short recipientCount,Boolean more)
- {
- this->WriteResolvedRecipient(unpackedRecipient.ExtValue(),recipientType, recipientCount,more); // we know its a string.
- }
-
-
- //--------------------------------------------------------------------------
- void COutgoingLetterStream::WriteResolvedRecipient(StringPtr /*recipient*/,short /*recipientType*/,short /*recipientCount*/,Boolean /*more*/)
- {
- ASSERTPRINT(false,("Must Override COutgoingLetterStream::WriteResolvedRecipient \n") );
-
- }
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::BeginUnResolvedRecipients(short recipientType)
- {
-
- // We assume in the base class here that the unresolved recipient list
- // is always put into the body part of the letter. If it isn't you will have
- // override this.
-
-
- Str255 headerStr;
-
- headerStr[0] = 0;
-
- switch(recipientType) {
-
- case kMailToBit:
- GetIndString(headerStr, kLetterHeaderStringsResID, kUnResolvedToHeader);
- break;
-
- case kMailCcBit:
- GetIndString(headerStr, kLetterHeaderStringsResID, kUnResolvedCcHeader);
- break;
-
- default:
- ASSERTPRINT(false,("COutgoingLetterStream::BeginUnResolvedRecipients Unknown recipient type =%0X\n",recipientType) );
- break;
- };
-
-
- this->WriteBodyStr(headerStr);
-
-
- }
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::EndUnResolvedRecipients(short /*recipientType*/)
- {
- this->WriteBodyStr("\n\n\n"); // more assumptions.
- }
-
-
-
- //--------------------------------------------------------------------------------
- void COutgoingLetterStream::WriteUnResolvedRecipient(CUnpackedDSSpec& unpackedRecipient,short recipientType,long recipientCount)
- {
- Str255 otherRecipient; // un resolved Recipient
- ::MapOtherRecipient(unpackedRecipient,otherRecipient);
-
- this->WriteUnResolvedRecipient(otherRecipient,recipientType, recipientCount);
-
- }
-
-
- //--------------------------------------------------------------------------
- void COutgoingLetterStream::WriteUnResolvedRecipient(StringPtr recipient,short /*recipientType*/,long recipientCount)
- {
- // Assumption : that the unresolved recipients are placed in the
- // outgoing letters body. --- could be presumptious.
-
- if( recipientCount != 1 )
- this->WriteBodyStr(",\n");
-
-
- this->WriteBodyStr(recipient);
-
- }
-